import {_decorator, Component, Node, Label} from 'cc';
import {ScrollViewScript} from "db://assets/Scene/Script/3.UI_Script/ScrollViewScript";

const {ccclass, property} = _decorator;

@ccclass('ButtonGroup')
export class ButtonGroup extends Component {
    @property(ScrollViewScript)
    scrollView!: ScrollViewScript;
    @property(Node)
    button1!: Node


    start() {
        this.showItemCount()
    }

    showItemCount() {
        let itemCount = this.scrollView.itemCount;
        this.button1.children.forEach((child) => {
            child.getComponent(Label)!.string = '按钮item数量:' + itemCount
        })
    }

    update(deltaTime: number) {

    }

    addItem() {
        this.scrollView.add()
        this.showItemCount()
    }

    minItem() {
        this.scrollView.min()
        this.showItemCount()
    }
}


